package com.hm.health.entity;

import java.util.ArrayList;
import java.util.List;

public class EcgFlashRecordBean {
    private String mTesterName = "";
    private String mTestScene = "";
    private String mTestRandomNum = "";
    private String testRecordId = "";
    private List<CsvFile> csvFiles;

    public static class CsvFile {
        public long startTimeStamp;
        public long endTimeStamp;
        public String recordPath;
        public String rawDataPath;
        public int csvId;
        public boolean hasAlgoResult;

        public CsvFile(long startTimeStamp, long endTimeStamp, String recordPath, String rawDataPath, int csvId, boolean hasAlgoResult) {
            this.startTimeStamp = startTimeStamp;
            this.endTimeStamp = endTimeStamp;
            this.recordPath = recordPath;
            this.rawDataPath = rawDataPath;
            this.csvId = csvId;
            this.hasAlgoResult = hasAlgoResult;
        }
    }

    public EcgFlashRecordBean() {
        csvFiles = new ArrayList<>();
    }

    public int getRecordNum() {
        return csvFiles.size();
    }

    public String getTesterName() {
        return mTesterName;
    }

    public void setTesterName(String testerName) {
        this.mTesterName = testerName;
    }

    public String getmTestScene() {
        return mTestScene;
    }

    public void setmTestScene(String mTestScene) {
        this.mTestScene = mTestScene;
    }

    public void appendRecord(CsvFile file) {
        for (CsvFile f : csvFiles) {
            if (f.recordPath.equals(file.recordPath))
                return;
        }
        csvFiles.add(file);
    }

    public CsvFile getRecord(int index) {
        return csvFiles.get(index);
    }

    public String getTestRecordId() {
        return testRecordId;
    }

    public void setTestRecordId(String testRecordId) {
        String arr[] = testRecordId.split("-");
        if (arr.length >= 3) {
            this.mTestScene = arr[0];
            this.mTesterName = arr[1];
            this.mTestRandomNum = arr[2];
        } else if (arr.length >= 2) {
            this.mTestScene = arr[0];
            this.mTesterName = arr[1];
        }
        this.testRecordId = testRecordId;
    }
}
